package com.yc.rh.entities;

import java.io.Serializable;

import com.yc.rh.utils.MD5Encryption;
/*
 * 会员信息
 * */
public class UserInfo implements Serializable {

	private static final long serialVersionUID = 1L;
	private int usid;//会员编号
	private String uname;//会员�?
	private String pwd;//密码
	private String email;//邮箱
	private String tel;//联系方式
	private String province;//省份
	private String city;//城市
	private String area;//地区
	private String udate;//注册时间
	private int status;//状�?
	private String temp;//备用字段
	private String flag;
	
	@Override
	public String toString() {
		return "UserInfo [usid=" + usid + ", uname=" + uname + ", pwd=" + pwd
				+ ", email=" + email + ", tel=" + tel + ", province="
				+ province + ", city=" + city + ", area=" + area + ", udate="
				+ udate + ", status=" + status + ", temp=" + temp + ", flag="
				+ flag + "]";
	}

	public  UserInfo(int usid, String uname, String pwd, String email,
			String tel, String province, String city, String area,
			String udate, int status, String temp, String flag) {
		super();
		this.usid = usid;
		this.uname = uname;
		this.pwd = pwd;
		this.email = email;
		this.tel = tel;
		this.province = province;
		this.city = city;
		this.area = area;
		this.udate = udate;
		this.status = status;
		this.temp = temp;
		this.flag = flag;
	}

	public  UserInfo() {
		super();
	}

	public int getUsid() {
		return usid;
	}

	public void setUsid(int usid) {
		this.usid = usid;
	}

	public String getUname() {
		return uname;
	}

	public void setUname(String uname) {
		this.uname = uname;
	}

	public String getPwds() {
		return MD5Encryption.createPassword(pwd);
	}
	public String getPwd() {
		return pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}

	public String getUdate() {
		if(udate!=null && udate.contains(".")){
			udate=udate.substring(0, udate.indexOf("."));
		}
		return udate;
	}

	public void setUdate(String udate) {
		this.udate = udate;
	}


	public String getStatuss() {
		if(status==0){
			return "锁定";
		}else{
			return "正常";
		}
	}
	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getTemp() {
		return temp;
	}

	public void setTemp(String temp) {
		this.temp = temp;
	}

	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((area == null) ? 0 : area.hashCode());
		result = prime * result + ((city == null) ? 0 : city.hashCode());
		result = prime * result + ((email == null) ? 0 : email.hashCode());
		result = prime * result + ((flag == null) ? 0 : flag.hashCode());
		result = prime * result
				+ ((province == null) ? 0 : province.hashCode());
		result = prime * result + ((pwd == null) ? 0 : pwd.hashCode());
		result = prime * result + status;
		result = prime * result + ((tel == null) ? 0 : tel.hashCode());
		result = prime * result + ((temp == null) ? 0 : temp.hashCode());
		result = prime * result + ((udate == null) ? 0 : udate.hashCode());
		result = prime * result + ((uname == null) ? 0 : uname.hashCode());
		result = prime * result + usid;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UserInfo other = (UserInfo) obj;
		if (area == null) {
			if (other.area != null)
				return false;
		} else if (!area.equals(other.area))
			return false;
		if (city == null) {
			if (other.city != null)
				return false;
		} else if (!city.equals(other.city))
			return false;
		if (email == null) {
			if (other.email != null)
				return false;
		} else if (!email.equals(other.email))
			return false;
		if (flag == null) {
			if (other.flag != null)
				return false;
		} else if (!flag.equals(other.flag))
			return false;
		if (province == null) {
			if (other.province != null)
				return false;
		} else if (!province.equals(other.province))
			return false;
		if (pwd == null) {
			if (other.pwd != null)
				return false;
		} else if (!pwd.equals(other.pwd))
			return false;
		if (status != other.status)
			return false;
		if (tel == null) {
			if (other.tel != null)
				return false;
		} else if (!tel.equals(other.tel))
			return false;
		if (temp == null) {
			if (other.temp != null)
				return false;
		} else if (!temp.equals(other.temp))
			return false;
		if (udate == null) {
			if (other.udate != null)
				return false;
		} else if (!udate.equals(other.udate))
			return false;
		if (uname == null) {
			if (other.uname != null)
				return false;
		} else if (!uname.equals(other.uname))
			return false;
		if (usid != other.usid)
			return false;
		return true;
	}
}
